- unless @photos.empty?
  %h2
    = "Found #{pluralize(@photos.length, 'photo')} matching the term"
    %span.search_term= "\"#{params[:term]}\""
  %div.photo_results
    - @photos.each do |photo|
      - if photo.is_private?
        - if logged_in? && current_user.authorized_to_view?(photo)
          %table.photo
            %tr
              %td.photo
                %a{:href => photo_url(photo), :title => (photo.caption ? photo.caption : photo.filename), :alt => (photo.caption ? photo.caption : photo.filename)}
                  %img.photo_thumb{:src => photo.public_filename(:thumb), :title => (photo.caption ? photo.caption : photo.filename), :alt => (photo.caption ? photo.caption : photo.filename)}
      - else
        %table.photo
          %tr
            %td.photo
              %a{:href => photo_url(photo), :title => (photo.caption ? photo.caption : photo.filename), :alt => (photo.caption ? photo.caption : photo.filename)}
                %img.photo_thumb{:src => photo.public_filename(:thumb), :title => (photo.caption ? photo.caption : photo.filename), :alt => (photo.caption ? photo.caption : photo.filename)}